package vip.bblog.elasticsearch.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * @author <a href="yuyong@cqyyt.com">Yu Yong</a>
 * @version 1.0
 * @date 2019年05月10日 10:12
 * @desc SwaggerConfig Swagger2配置
 */
@Configuration
@EnableSwagger2
public class SwaggerConfig {

    @Bean
    public Docket api() {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo())
                .select()
                .build();
    }

    private ApiInfo apiInfo() {
        return new ApiInfoBuilder()
                .title("ES搜索中心")
                .description("ES搜索中心 API 2.0 操作文档")
                .termsOfServiceUrl("http://www.bblog.vip")
                .version("1.0")
                .contact(new Contact("BBLOG", "http://www.bblog.vip", "1396513066@qq.com"))
                .build();
    }
}
